{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
  {% for category, message in messages %}
    {% if category in ["message", "info"] %}
      <div class="alert alert-info alert-dismissible fade show" role="alert">
        <strong>提示: </strong>{{ message }}
        <button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
      </div>
    {% elif category == "warning" %}
      <div class="alert alert-warning alert-dismissible fade show" role="alert">
        <strong>警告: </strong>{{ message }}
        <button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
      </div>
    {% elif category == "error" %}
      <div class="alert alert-danger alert-dismissible fade show" role="alert">
        <strong>错误: </strong>{{ message }}
        <button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
      </div>
    {% elif category == "success" %}
      <div class="alert alert-success alert-dismissible fade show" role="alert">
        <strong>成功: </strong>{{ message }}
        <button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
      </div>
    {% else %}
      <div class="alert alert-info alert-dismissible fade show" role="alert">
        <strong>提示: </strong>{{ message }}
        <button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
      </div>
    {% endif %}
  {% endfor %}
{% endif %}
{% endwith %}